package org.jeecg.modules.system.model;

import org.jeecg.modules.data.entity.District;
import org.jeecg.modules.data.entity.DistrictTree;
import org.jeecg.modules.system.entity.SysDepart;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 区域表 封装树结构的区域的名称的实体类
 * <p>
 *
 * @Author Steve
 * @Since 2025-02-13
 *
 */
public class DistrictIdModel implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    private String key;

    /**
     * 主键ID
     */
    private String value;

    /**
     * 区域名称
     */
    private String title;
    /**
     * 区域名称
     */
    private String type;
    /**
     * 章
     */
    private String officialSeal;

    List<DistrictIdModel> children = new ArrayList<>();

    /**
     * 将DistrictTree的部分数据放在该对象当中
     * @param treeModel
     * @return
     */
    public DistrictIdModel convert(DistrictTree treeModel) {
        this.key = treeModel.getCantCode();
        this.value = treeModel.getCantCode();
        this.title = treeModel.getCantName();
        this.type = treeModel.getCantType();
        this.officialSeal = treeModel.getOfficialSeal();
        return this;
    }

    /**
     * 该方法为用户区域的实现类所使用
     * @param district
     * @return
     */
    public DistrictIdModel convertByUserDepart(District district) {
        this.key = district.getCantCode();
        this.value = district.getCantCode();
        this.title = district.getCantName();
        this.type = district.getCantType();
        this.officialSeal = district.getOfficialSeal();
        return this;
    }

    public List<DistrictIdModel> getChildren() {
        return children;
    }

    public void setChildren(List<DistrictIdModel> children) {
        this.children = children;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getOfficialSeal() {
        return officialSeal;
    }

    public void setOfficialSeal(String officialSeal) {
        this.officialSeal = officialSeal;
    }
}
